Semi-Parallel Processes


Once we use Refresh() command in the loop we start Semi-Parallel process or what we call Parallel loop.
That means while the loop is still counting we can interact with any objects, run other short scripts and make other actions.

See first example: Normal loop
For n=0 To 10000
    a=n+1
Next n

 

Normal loop will pause the MMB (it will be inactive) for the time until loop will finish. You can't click on any buttons during the looping.

This is Parallel loop:
For n=0 To 10000
    a=n+1
    Refresh()
Next n

The command Refresh() will process the parallel interactions - that means while the loop is still looping we can click on buttons and run short scripts.

You have to remember
Any other (parallel or not) loop will pause the first one until the second will be finished. See the chart below

The loop chart:

You should use Prallel loop only if you are certain what it does.

Example of using infinite loop.
With Parallel loop we can use also infinite loop option. (But you have to remember to exit)
The script will make the object Circle sticky to the mouse cursor - until some other object doesn't set the stop to 1.

stop = 0
For n=0 To Infinity
    MoveObject("Circle"," MOUSEX(),MOUSEY()")
    If (stop=1) Then
        Return()
    End
    Refresh()
Next n